import { modal } from 'vue-strap'
import {
	autoImportExcel,
  showMsg
} from '../../../../vuex/action.js'

export default {
  data() {
    return {
      showAutoExcel: false,
      excelParam: {
        excel: ''
      }
    }
  },
  vuex: {
		actions: {
			xAutoImportExcel: autoImportExcel,
      xShowMsg: showMsg
		}
	},
  methods: {
    evtShowAutoExcel() {
      this.showAutoExcel = true
    },
    submit() {
			let formData = new FormData()
			formData.append('excel', this.$els.file.files[0])

			this.xAutoImportExcel(formData)
				.then((res) => {
          this.showAutoExcel = false
				})
        .catch((res) => {
          this.xShowMsg({
            type: 'danger',
            content: res.error_msg
          })
        })
		}
  },
  components: {
    'vue-modal': modal
  }
}
